<template>
	<view :data-theme="themeStyle">
		<view class="goods-detail" :class="isIphoneX ? 'active' : ''">
			<view class="goods-container">
				<!-- 商品媒体信息 -->
				<view class="goods-media">
					<!-- 商品图片 -->
					<view class="goods-img" :class="{ show: switchMedia == 'img' }">
						<swiper class="swiper" @change="swiperChange" :interval="swiperInterval" :autoplay="swiperAutoplay">
							<swiper-item v-for="(item, index) in goodsSkuDetail.sku_images" :key="index">
								<view class="item" @click="previewMedia(index)">
									<image :src="$util.img(item, { size: 'big' })" @error="swiperImageError(index)" mode="aspectFit" />
								</view>
							</swiper-item>
						</swiper>
						<view class="img-indicator-dots">
							<text>{{ swiperCurrent }}</text>
							<text v-if="goodsSkuDetail.sku_images">/{{ goodsSkuDetail.sku_images.length }}</text>
						</view>
					</view>
					<!-- 商品视频 -->
					<view class="goods-video" :class="{ show: switchMedia == 'video' }">
						<video :src="$util.img(goodsSkuDetail.video_url)" :poster="$util.img(goodsSkuDetail.sku_image, { size: 'big' })" objectFit="cover"></video>
					</view>

					<!-- 切换视频、图片 -->
					<view class="media-mode" v-if="goodsSkuDetail.video_url != ''">
						<text :class="{ 'ns-bg-color': switchMedia == 'video' }" @click="switchMedia = 'video'">{{ $lang('video') }}</text>
						<text :class="{ 'ns-bg-color': switchMedia == 'img' }" @click="switchMedia = 'img'">{{ $lang('image') }}</text>
					</view>

					<view class="follow-and-share" v-if="preview == 0">
						<view class="follow" @click="openSharePopup()"><text class="iconfont iconiconfontzhizuobiaozhun023130"></text></view>
						<view class="share ns-margin-left" @click="editCollection()">
							<text class="iconfont" :class="whetherCollection == 1 ? 'iconlikefill ns-text-color' : 'icongz'"></text>
						</view>
					</view>
				</view>
				<!-- 限时折扣 -->
				<view v-if="preview == 0 && goodsSkuDetail.promotion_type == 1 && goodsSkuDetail.discountTimeMachine && addonIsExit.discount && showDiscount" class="goods-discount">
						<view class="price-info">
							<template>
								<view class="discount-price">
									<text class="symbol">{{ $lang('common.currencySymbol') }}</text>
									<text>{{ goodsSkuDetail.discount_price }}</text>
								</view>
								<view class="original-price">
									<!-- <text class="price">{{ $lang('common.currencySymbol') }} {{ goodsSkuDetail.price }}</text> -->
									<text class="price">{{ $lang('common.currencySymbol') }} {{ goodsSkuDetail.price}}</text>
									<text class="sale-num">{{ goodsSkuDetail.sale_num }}{{ goodsSkuDetail.unit }}已售</text>
								</view>
							</template>
						</view>
						
						<view class="countdown" >
							<view class="txt">距结束仅剩</view>
							<view class="clockrun">
								<uni-count-down
									:day="goodsSkuDetail.discountTimeMachine.d"
									:hour="goodsSkuDetail.discountTimeMachine.h"
									:minute="goodsSkuDetail.discountTimeMachine.i"
									:second="goodsSkuDetail.discountTimeMachine.s"
									color="#fff"
									splitorColor="#000 !important"
									backgroundColorClass="ns-bg-color"
								/>
							</view>
						</view>
				</view>

				<view class="group-wrap ns-padding-top">
					<view class="goods-module-wrap" :class="{ discount: preview == 0 && goodsSkuDetail.promotion_type == 1 }" v-if="goodsSkuDetail.promotion_type == 0 || (goodsSkuDetail.promotion_type == 1 && goodsSkuDetail.member_price>0 && (Number(goodsSkuDetail.member_price) < Number(goodsSkuDetail.discount_price)))">
						<view class="goods-module-wrap-box">
							<template>
								<text class="price-symbol ns-text-color">{{ $lang('common.currencySymbol') }}</text>
								<text class="price ns-text-color">{{ goodsSkuDetail.price }}</text>
								<block v-if="goodsSkuDetail.member_price>0">
									<view class="member-name" ><!-- 会员价 -->
										<image :src="$util.img('upload/uniapp/index/VIP.png')" mode="aspectFit"></image>
									</view>
									<text class="member-price-symbol">{{ $lang('common.currencySymbol') }}</text>
									<text class="member-price">{{ goodsSkuDetail.member_price }}</text>
								</block>
							</template>
						</view>
					</view>
					<view class="goods-module-wrap info">
						<view>
							<view class="sku-name-wrap" v-if="showFenxiao!=0 && levelInfo.words_account&&levelInfo.commission_money ">
								<view class="sku-name" >{{ goodsSkuDetail.sku_name }}</view>
								<view class="wrap" @click="openSharePopup()">
									<text class="iconfont iconfenxiang2 ns-text-color ns-font-size-xxx-lg"></text>
									<!-- <image class="fx" :src="$util.img('upload/uniapp/goods/fx.png')" mode="aspectFill"></image> -->
									<view class="fx-wrap ">
										<view class="left ns-text-color">
											返
										</view>
										<view class="right">
											<view class="ns-text-color">￥{{levelInfo.commission_money}}</view>
										</view>
									</view>
								</view>
							</view>
							<view v-else>{{ goodsSkuDetail.sku_name }}</view>
							<text class="introduction ns-margin-top ns-text-color" v-if="goodsSkuDetail.introduction">{{ goodsSkuDetail.introduction }}</text>
						</view>
						<view class="adds-wrap">
							<block v-if="Development">
								<text v-if="goodsSkuDetail.is_free_shipping">快递：包邮</text>
								<text v-else>快递：买家承担</text>
							</block>
							<text>库存 {{ goodsSkuDetail.stock }}{{ goodsSkuDetail.unit }}</text>
							<text>总销量 {{ goodsSkuDetail.sale_num }} {{ goodsSkuDetail.unit }}</text>
						</view>
					</view>
				</view>
				<!-- 分享下放尝试 -->
				<!-- <view class="group-wrap"@click="openSharePopup()">
					<view class="goods-module-wrap info" >点击分享
					<span style="text-align: right;float: right;line-height: 40upx;" @click="openSharePopup()"><text class="iconfont iconiconfontzhizuobiaozhun023130"></text></span>
					</view>
				</view> -->
				<!-- 当前商品参与的营销活动入口 -->
				<!-- 	<view class="group-wrap"><ns-goods-promotion ref="goodsPromotion" promotion="discount"></ns-goods-promotion></view> -->

				<ns-fenxiao-goods-detail :skuId="skuId" ref="fenxiaoPopup"></ns-fenxiao-goods-detail>

				<view class="newdetail ns-margin-bottom">
					<view class="newdetail-item coupon"  v-if="preview == 0 && couponList.length">
						<view class="coupon-info" @click="openCouponPopup()">
							<view class="coupon-image">
								<text class="ns-text-color-gray ns-font-size-base"> 领券</text>
							</view>
							<view class="coupon-content">
								<view class="coupon-content_item ns-border-color"  v-for="(item, index) in couponList" :key="index" v-if="index < 2"  >
									<view class=" ns-text-color" v-if="item.money>0">满{{$util.numberFixed(item.at_least)}}减{{$util.numberFixed(item.money)}}</view>
									<view class=" ns-text-color" v-if="item.discount>0">满{{$util.numberFixed(item.at_least)}}享{{$util.numberFixed(item.discount,1)}}折</view>
								</view>
							</view>
							<view class="coupon-right">
								<text class="coupon-more" >
									领取
								</text>
								<text class="iconfont iconright"></text>
							</view>
						</view>
						
						
					</view>
					<view class="newdetail-item free" v-if="manjian.rule_json !== null && addonIsExit.manjian" @click="openManjianPopup()">
						<view class="free-info">
							<view class="free-image" >
								<text class="ns-text-color-gary" >促销</text>
							</view>
							<view class="free-content">
								<text class="free-tip ns-text-color ns-border-color">满减</text>{{ manjian.manjian_name }}
							</view>
						</view>
						<text class="iconfont iconright"></text>
					</view>
					<view class="newdetail-item service"  @click="openMerchantsServicePopup()" v-if="goodsSkuDetail.goods_service.length">
						<view class="service-info">
							<text class="tit">服务</text>
							<text class="service-item" v-for="(item, index) in goodsSkuDetail.goods_service" :key="index">
								<text class="iconfont icondui ns-text-color"></text>
								<text>{{item.service_name}}</text>
							</text>
						</view>
						<text class="iconfont iconright"></text>
					</view>
				</view>

				<view class="group-wrap">
					<!-- 已选规格 -->
					<view class="goods-cell selected-sku-spec goods-attribute" v-if="goodsSkuDetail.sku_spec_format" @click="joinCart">
						<view class="box">
							<text class="tit">选择</text>
							<text v-for="(item, index) in goodsSkuDetail.sku_spec_format" :key="index">{{ item.spec_name }}/{{ item.spec_value_name }}</text>
						</view>
						<text class="iconfont iconright"></text>
					</view>

					<!-- 商品属性 -->
					<view class="goods-cell goods-attribute" @click="openAttributePopup()" v-if="goodsSkuDetail.goods_attr_format && goodsSkuDetail.goods_attr_format.length > 0">
						<view class="box">
							<text class="tit">规格参数</text>
						</view>
						<text class="iconfont iconright"></text>
					</view>
				</view>
				<!-- 规格参数 -->
				<view @touchmove.prevent.stop>
					<uni-popup ref="attributePopup" type="bottom">
						<view class="goods-attribute-popup-layer">
							<text class="title">规格参数</text>
							<scroll-view scroll-y class="goods-attribute-body">
								<view class="item ns-border-color-gray" v-for="(item, index) in goodsSkuDetail.goods_attr_format" :key="index">
									<text class="ns-text-color-gray">{{ item.attr_name }}</text>
									<text class="value">{{ item.attr_value_name }}</text>
								</view>
							</scroll-view>
							<view class="button-box"><button type="primary" @click="closeAttributePopup()">确定</button></view>
						</view>
					</uni-popup>
				</view>
				
				<!-- 营销活动 -->
				<view class="group-wrap" v-if="preview == 0">
					<!-- 优惠券 -->
					<view @touchmove.prevent.stop v-if="couponList.length">
						<uni-popup ref="couponPopup" type="bottom">
							<view class="goods-coupon-popup-layer" >
								<text class="tax-title ns-text-color-black" @click="closeCouponPopup()">优惠券 <text class="iconfont iconclose"></text></text>
								<scroll-view class="coupon-body" scroll-y>
									<view class="body-item ns-gradient-diy-goods-list" v-for="(item, index) in couponList" :key="index" :data-theme="themeStyle">
										<view class="item-price ns-gradient-detail-coupons-right-border" :data-theme="themeStyle">
											<text class="price" v-if="item.discount>0"><text class="price-num">{{ item.discount }}折</text></text>
											<text class="price" v-else>￥<text class="price-num">{{ item.money }}</text></text>
											<view class="sub" v-if="item.at_least > 0">满{{ item.at_least }}元使用</view>
										</view>
										<view class="item-info">
											<view class="info-box">
												<text v-if="item.discount>0" class="sub">{{ '满' + item.at_least + '享' + item.discount }}折优惠</text>
												<text v-else-if="item.money > 0" class="sub">{{ '满' + item.at_least + '减' + item.money }}</text>
												<text v-else class="sub">无门槛优惠券</text>
												<view class="sub" v-if="item.validity_type == 0">有效期至 {{ $util.timeStampTurnTime(item.end_time) }}</view>
												<view class="sub" v-else>领取之日起{{ item.fixed_term }}天内有效</view>
											</view>
											<view class="item-btn" :class="item.is_lingqu != undefined?'ns-bg-color-gray':'ns-gradient-detail-coupons'" :data-theme="themeStyle" @click="receiveCoupon(item.coupon_type_id)" >{{item.is_lingqu != undefined ? '已领取':'领取'}}</view>
										</view>
										
									</view>
									<view class="free_div"></view>
								</scroll-view>
								<view class="button-box"><button type="primary" @click="closeCouponPopup()">确定</button></view>
							</view>
						</uni-popup>
					</view>

					<view @touchmove.prevent.stop v-if="addonIsExit.manjian">
						<uni-popup ref="manjianPopup" type="bottom">
							<view class="manjian-popup-layer">
								<text class="title ns-text-color-black" @click="closeManjianPopup()">促销 <text class="iconfont iconclose"></text></text>
								<scroll-view scroll-y class="manjian-body">
									<view class="item ns-border-color-gray">
										<view v-if="manjian.manjian != undefined ">
											<text class="free-tip ns-text-color ns-border-color">满减</text><text class="ns-font-size-sm">{{ manjian.manjian }}</text>
										</view>
										<view v-if="manjian.mansong != undefined ">
											<text class="free-tip ns-text-color ns-border-color">满送</text><text class="ns-font-size-sm">{{ manjian.mansong }}</text>
										</view>
										<view v-if="manjian.free_shipping != undefined ">
											<text class="free-tip ns-text-color ns-border-color">包邮</text><text class="ns-font-size-sm">{{ manjian.free_shipping }}</text>
										</view>
									</view>
								</scroll-view>
								<view class="button-box"><button type="primary" @click="closeManjianPopup()">确定</button></view>
							</view>
						</uni-popup>
					</view>

					<view @touchmove.prevent.stop>
						<uni-popup ref="merchantsServicePopup" type="bottom">
							<view class="goods-merchants-service-popup-layer">
								<text class="tax-title ns-text-color-black"  @click="closeMerchantsServicePopup()">{{ $lang('service') }} <text class="iconfont iconclose"></text></text>
								<scroll-view scroll-y>
									<view class="item" v-for="(item, index) in goodsSkuDetail.goods_service" :key="index">
										<view class="iconfont icondui ns-text-color"></view>
										<view class="info-wrap">
											<text class="title">{{ item.service_name }}</text>
											<text class="describe">{{ item.desc }}</text>
										</view>
									</view>
								</scroll-view>
								<view class="button-box"><button type="primary" @click="closeMerchantsServicePopup()">确定</button></view>
							</view>
						</uni-popup>
					</view>
				</view>

				<!-- 组合套餐 -->
				<view v-if="preview == 0 && bundling.length && bundling[0].bl_name && addonIsExit.bundling">
					<view class="group-wrap" @click="openBundlingPopup()">
						<view class="goods-cell" @click="openBundlingPopup()">
							<view class="box">
								<text class="tit">组合套餐</text>
								<text>{{ bundling[0].bl_name }}</text>
							</view>
							<text class="iconfont iconright"></text>
						</view>
						<scroll-view class="combo-goods-wrap ns-text-color-gray" style="" scroll-x="true">
							<view class="combo-goods-view">
								<view class="goods ns-border-color-gray" @click="toGoodsDetail(skuId)">
									<view class="combo-img">
										<image :src="$util.img(goodsSkuDetail.sku_image, { size: 'mid' })" @error="imageError()" mode="aspectFit"/>
									</view>
									
									<text>￥{{ goodsSkuDetail.price }}</text>
								</view>
								<view class="iconfont iconadd1 "></view>
								<block v-for="(item, index) in bundling[0].bundling_goods" :key="index">
									<template v-if="index < 3">
										<view @click="toGoodsDetail(item.sku_id)" class="goods ns-border-color-gray">
											<view class="combo-img">
											<image :src="$util.img(item.sku_image, { size: 'mid' })" @error="bundlingImageError(0, index)" mode="aspectFit"/>
											</view>
											<text>￥{{ item.price }}</text>
										</view>
									</template>
								</block>
							</view>
							
						</scroll-view>
					</view>

					<view @touchmove.prevent.stop>
						<uni-popup ref="bundlingPopup" type="bottom">
							<view class="bundling-popup-layer">
								<text class="title" @click="closeBundlingPopup()">组合套餐<text class="iconfont iconclose" ></text></text>
								<scroll-view scroll-y class="bundling-body">
									<block v-for="(item, index) in bundling" :key="index">
										
											<view class="item ns-border-color-gray">
												<view class="value" @click="toComoDetail(item.bl_id)">
													<text>{{ item.bl_name }}：￥{{ item.bl_price }}</text>
													<view class="right">
														<text class="ns-text-color">购买</text>
														<text class="iconfont iconright"></text>
													</view>
												</view>
												<scroll-view scroll-x>
													<view class="goods-wrap">
														<view class="goods" @click="toGoodsDetail(skuId)">
															<view class="combo-img">
																<image :src="$util.img(goodsSkuDetail.sku_image, { size: 'mid' })" @error="imageError()" />
															</view>
															<text>￥{{ goodsSkuDetail.price }}</text>
														</view>
														<view class="iconfont iconadd1"></view>
														<block v-for="(goods, goods_index) in item.bundling_goods" :key="goods_index">
															<template v-if="goods_index < 3">
																<view class="goods" @click="toGoodsDetail(goods.sku_id)">
																	<view class="combo-img"><image :src="$util.img(goods.sku_image, { size: 'mid' })" @error="bundlingImageError(index, goods_index)" /></view>
																	<text>￥{{ goods.price }}</text>
																</view>
															</template>
														</block>
													</view>
												</scroll-view>
											</view>
										
									</block>
								</scroll-view>
								<view class="button-box"><button type="primary" @click="closeBundlingPopup()">确定</button></view>
							</view>
						</uni-popup>
					</view>
				</view>

				<!-- 商品评价 -->
				<view class="group-wrap" v-if="preview == 0">
					<view class="goods-evaluate">
						<view class="tit" :class="{active : goodsEvaluate.content}">
							<view>
								<text class="ns-font-size-base ns-text-color-black">宝贝评价（{{ goodsSkuDetail.evaluate }}）</text>
								<text class="evaluate-item-empty" v-if="!goodsEvaluate.content">暂无评价</text>
							</view>
						</view>
						<view class="evaluate-item" v-if="goodsEvaluate.content">
							<view class="evaluator">
								<view class="evaluator-info">
									<view class="evaluator-face">
										<image
											v-if="goodsEvaluate.member_headimg"
											:src="$util.img(goodsEvaluate.member_headimg)"
											@error="goodsEvaluate.member_headimg = $util.getDefaultImage().default_headimg"
											mode="aspectFill"
										/>
										<image
											v-else
											:src="$util.getDefaultImage().default_headimg"
											@error="goodsEvaluate.member_headimg = $util.getDefaultImage().default_headimg"
											mode="aspectFill"
										/>
									</view>
									<text class="evaluator-name">{{ goodsEvaluate.member_name }}</text>
								</view>
								<text class="creatTime ns-text-color-gray">{{ $util.timeStampTurnTime(goodsEvaluate.create_time) }}</text>
							</view>
							<view class="cont ns-margin-top ns-text-color-gray">{{ goodsEvaluate.content }}</view>
							<view class="evaluate-img" v-if="goodsEvaluate.images">
								<view class="img-box" v-for="(item, index) in goodsEvaluate.images" :key="index" @click="previewEvaluate(index, 'images')">
									<image :src="$util.img(item)" mode="aspectFit" />
								</view>
							</view>
							<block v-if="goodsEvaluate.again_content != ''">
								<view class="againEvaluate ns-text-color">
									追加评价
								</view>
								<view class="cont ns-margin-top ns-text-color-gray">{{ goodsEvaluate.again_content }}</view>
								<view class="evaluate-img" v-if="goodsEvaluate.again_images">
									<view class="img-box" v-for="(item, index) in goodsEvaluate.again_images" :key="index" @click="previewEvaluate(index, 'images')">
										<image :src="$util.img(item)" mode="aspectFit" />
									</view>
								</view>
							</block>
							<view @click="toEvaluateDetail(goodsSkuDetail.goods_id)" class="evaluateMore">
								<text>查看全部评论</text>
							</view>
						</view>
						
					</view>
				</view>

				<!-- 详情 -->
				<view class="goods-detail-tab">
					<view class="detail-tab">
						<view class="tab-item" :class="detailTab == 0 ? 'active ns-text-color ns-bg-before' : ''" @click="detailTab = 0">商品详情</view>
						<view class="tab-item" :class="detailTab == 1 ? 'active ns-text-color ns-bg-before' : ''" @click="detailTab = 1">售后保障</view>
					</view>
					<view class="detail-content" :class="detailTab == 1 ? 'active' : ''">
						<view class="detail-content-item" v-show="detailTab == 0">
							<view class="goods-details" v-if="goodsSkuDetail.goods_content"><rich-text :nodes="goodsSkuDetail.goods_content"></rich-text></view>
							<view class="goods-details active" v-else>该商家暂无上传相关详情哦！</view>
						</view>
						<view class="detail-content-item" v-show="detailTab == 1">
							<view class="goods-details" v-if="service"><rich-text :nodes="service"></rich-text></view>
							<view class="goods-details active" v-else>该商品暂无相关售后哦！</view>
						</view>
					</view>
				</view>

				<view v-if="preview == 0"><nsGoodsRecommend ref="goodrecommend"></nsGoodsRecommend></view>

				<!-- SKU选择 -->
				<ns-goods-sku ref="goodsSku" @refresh="refreshGoodsSkuDetail" :goods-detail="goodsSkuDetail" :max-buy="goodsSkuDetail.max_buy" :min-buy="goodsSkuDetail.min_buy"></ns-goods-sku>

				<!-- 海报 -->
				<view @touchmove.prevent.stop>
					<uni-popup ref="posterPopup" type="bottom" class="poster-layer">
						<template v-if="poster != '-1'">
							<view :style="{ height: posterHeight > 0 ? posterHeight + 80 + 'px' : '' }">
								<view class="image-wrap"><image :src="$util.img(poster)" :style="{ height: posterHeight > 0 ? posterHeight + 'px' : '' }" /></view>
								<!-- #ifdef MP -->
								<view class="save" @click="saveGoodsPoster()">保存图片</view>
								<!-- #endif -->
								<!-- #ifdef H5 -->
								<view class="save">长按保存图片</view>
								<!-- #endif -->
							</view>
							<view class="close iconfont iconclose" @click="closePosterPopup()"></view>
						</template>
						<view v-else class="msg">{{ posterMsg }}</view>
					</uni-popup>
				</view>

				<!-- 分享弹窗 -->
				<view @touchmove.prevent.stop>
					<uni-popup ref="sharePopup" type="bottom" class="share-popup">
						<view>
							<view class="share-title">分享</view>
							<view class="share-content">
								<!-- #ifdef MP -->
								<view class="share-box">
									<button class="share-btn" :plain="true" open-type="share">
										<view class="iconfont iconiconfenxianggeihaoyou"></view>
										<text>分享给好友</text>
									</button>
								</view>
								<!-- #endif -->
								<!-- #ifdef MP-WEIXIN -->
								<view class="share-box" v-if="goodsCircle">
									<button class="share-btn" :plain="true" @click="openBusinessView">
										<view class="iconfont iconhaowuquan"></view>
										<text>分享到好物圈</text>
									</button>
								</view>
								<!-- #endif -->
								<!-- <view class="share-box" @click="openPosterPopup">
									<button class="share-btn" :plain="true">
										<view class="iconfont iconpengyouquan"></view>
										<text>生成分享海报</text>
									</button>
								</view> -->
							</view>
							<view class="share-footer" @click="closeSharePopup"><text>取消分享</text></view>
						</view>
					</uni-popup>
				</view>
				<ns-login ref="login"></ns-login>
			</view>
		</view>
		<loading-cover ref="loadingCover"></loading-cover>
		<!-- 商品底部导航 -->
		<ns-goods-action :safeArea="isIphoneX">
			<template v-if="goodsSkuDetail.goods_state == 1">
				<ns-goods-action-icon text="首页" icon="iconshouye" @click="goHome" />
				<ns-goods-action-icon text="客服" icon="iconkefu" open-type="contact" :send-data="contactData" />
				<ns-goods-action-icon text="购物车" icon="icongouwuche" :corner-mark="cartCount > 0 ? cartCount + '' : ''" @click="goCart" />
				<block v-if="goodsSkuDetail.max_buy != 0 && goodsSkuDetail.purchased_num >= goodsSkuDetail.max_buy">
					<ns-goods-action-button class="goods-action-button active3" disabled-text="已达最大限购数量" :disabled="true" />
				</block>
				<block v-else>
					<ns-goods-action-button
						class="goods-action-button"
						:class="goodsSkuDetail.is_virtual == 0 ? 'active1' : ''"
						text="加入购物车"
						background="#ffac32"
						@click="joinCart"
						v-if="goodsSkuDetail.is_virtual == 0"
					/>
					<ns-goods-action-button class="goods-action-button" :class="goodsSkuDetail.is_virtual == 0 ? 'active2' : 'active4'" text="立即购买" @click="buyNow" />
				</block>
			</template>
			<template v-else>
				<ns-goods-action-button class="goods-action-button active3" disabled-text="该商品已下架" :disabled="true" />
			</template>
		</ns-goods-action>
		<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
		<ns-show-toast></ns-show-toast>
	</view>
</template>

<script>
import nsGoodsAction from '@/components/ns-goods-action/ns-goods-action.vue';
import nsGoodsActionIcon from '@/components/ns-goods-action-icon/ns-goods-action-icon.vue';
import nsGoodsActionButton from '@/components/ns-goods-action-button/ns-goods-action-button.vue';
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import nsGoodsSku from '@/components/ns-goods-sku/ns-goods-sku.vue';
import nsGoodsRecommend from '@/components/ns-goods-recommend/ns-goods-recommend.vue';
import uniCountDown from '@/components/uni-count-down/uni-count-down.vue';
import detail from '../public/js/detail.js';
import scroll from '@/common/js/scroll-view.js';
import nsFenxiaoGoodsDetail from '@/components/ns-fenxiao-goods-detail/ns-fenxiao-goods-detail.vue';
import nsGoodsPromotion from '@/components/ns-goods-promotion/ns-goods-promotion.vue';
import globalConfig from '@/common/js/golbalConfig.js';
import toTop from '@/components/toTop/toTop.vue';
import nsShowToast from '@/components/ns-show-toast/ns-show-toast.vue'

export default {
	components: {
		nsGoodsAction,
		nsGoodsActionIcon,
		nsGoodsActionButton,
		uniPopup,
		nsGoodsSku,
		nsGoodsRecommend,
		uniCountDown,
		nsFenxiaoGoodsDetail,
		nsGoodsPromotion,
		toTop,
		nsShowToast
	},
	data() {
		return {
		};
	},
	computed:{
		showDiscount(){
			return (this.goodsSkuDetail.member_price>0 && Number(this.goodsSkuDetail.member_price) >= Number(this.goodsSkuDetail.discount_price)) || !this.goodsSkuDetail.member_price
		}
	},
	methods:{
		
	},
	onLoad(data) {
		// console.log(data,"分享")
		this.code_id=data.shop_id
		this.tuicode()
	},
	onShow() {
		
	},
	mixins: [detail, scroll, globalConfig],
	/**
	 * 自定义分享内容
	 * @param {Object} res
	 */
	onShareAppMessage(res) {
		var path = '/pages/goods/detail/detail?sku_id=' + this.skuId+'&shop_id='+this.memberId;
		if (this.memberId) path += '&source_member=' + this.memberId;
		return {
			title: this.goodsSkuDetail.sku_name,
			imageUrl: this.$util.img(this.goodsSkuDetail.sku_image, {
				size: 'big'
			}),
			path: path,
			success: res => {},
			fail: res => {}
		};
	},
	methods:{
		tuicode(){
			uni.setStorage({
				key: 'code_id',
				data:this.code_id,
				// data:'38',
				success: () => {
					// console.log("缓存成功",this.code_id)
				}
			})
		},
		toGoodsDetail(item){
			this.$util.redirectTo('/pages/goods/detail/detail',{sku_id:item})
		},
		toComoDetail(id){
			this.$util.redirectTo('/promotionpages/combo/detail/detail',{bl_id:id})
		},
		toEvaluateDetail(id){
			this.$util.redirectTo('/otherpages/goods/evaluate/evaluate',{goods_id:id})
		}
	},
	// #ifdef MP-WEIXIN
	// 分享到微信朋友圈
	onShareTimeline(){
		let query = 'sku_id=' + this.skuId;
		if (this.memberId) query += '&source_member=' + this.memberId;
		return {
			title: this.goodsSkuDetail.sku_name,
			query: query,
			imageUrl: this.$util.img(this.goodsSkuDetail.sku_image, {
				size: 'big'
			})
		} 
	}
	// #endif
};
</script>

<style lang="scss">
@import '../public/css/detail.scss';
</style>
<style scoped>
/deep/ .uni-video-cover {
	background: none;
}

/deep/ .uni-video-cover-duration {
	display: none;
}

/deep/ .uni-video-cover-play-button {
	border-radius: 50%;
	border: 4rpx solid #fff;
	width: 120rpx;
	height: 120rpx;
	background-size: 30%;
}

.poster-layer >>> .uni-popup__wrapper-box {
	max-height: initial !important;
}

/deep/ .sku-layer .uni-popup__wrapper-box {
	overflow-y: initial !important;
}

.goods-discount .countdown .clockrun >>> .uni-countdown__number {
	min-width: 32rpx;
	height: 32rpx;
	text-align: center;
	line-height: 32rpx;
	background: #000;
	/* // #690b08 */
	border-radius: 4px;
	display: inline-block;
	padding: 4rpx;
	margin: 0;
	border: none;
}

.goods-discount .countdown .clockrun >>> .uni-countdown__splitor {
	width: 10rpx;
	height: 32rpx;
	line-height: 36rpx;
	text-align: center;

	color: #000;
}

.goods-discount .countdown .clockrun >>> .uni-countdown__splitor.day {
	width: initial;
}

/deep/ .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
	max-height: unset !important;
}

/deep/ .goods-action-button.active1 {
	padding-left: 10px;
}

/deep/ .goods-action-button.active2 {
	padding-right: 10px;
}

/deep/ .goods-action-button.active3 {
	padding: 0 10px;
}

/deep/ .goods-action-button.active4 {
	padding: 0 10px;
}
/deep/ .uni-popup__wrapper.bottom{
	border-radius: 24rpx 24rpx 0 0
}
.goods-coupon-popup-layer .coupon-body .body-item .item-price{
	border-right:1px dashed rgba(0, 0, 0, 0.2) !important;
}
/deep/ .goods-action-button.active1 .action-buttom-wrap {
	height: 36px;
	line-height: 36px;
	border-top-left-radius: 36rpx;
	border-bottom-left-radius: 36rpx;
}

/deep/ .goods-action-button.active2 .action-buttom-wrap {
	height: 36px;
	line-height: 36px;
	border-top-right-radius: 36rpx;
	border-bottom-right-radius: 36rpx;
}

/deep/ .goods-action-button.active3 .action-buttom-wrap {
	height: 36px;
	line-height: 36px;
	border-radius: 36px;
	margin: 20rpx 0;
}

/deep/ .goods-action-button.active4 .action-buttom-wrap {
	height: 36px;
	line-height: 36px;
	border-radius: 36px;
}
</style>
